<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	pageContext.setAttribute("path",path);
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<script type="text/javascript" >
$(function(){
	// var index = '${index}';	//无用
	$("#assign_grouprole_tree").tree({
		init_xg:"${groupsStr}",	//自定义
		checkbox:true, onlyLeafCheck:true, 
		url:"${path}/sysmanage/rolegroup/rolegroup_tree/json?index="+1+"&username="+'${data.username}',
		loadFilter: function(data){
	        if (data.rows){  
	            return data.rows;  
	        } else {  
	            return data;  
	        }
	    },
	    onLoadSuccess:function(node, data){
	    	var init = $(this).data("xx");
	    	if( init == 1){
	    		
	    	}else{
	    		$(this).data("xx",1);
	    		var groupsStr = $(this).tree("options").init_xg ;
	    		if( groupsStr ){
	    			var groups = groupsStr.split("," );
	    			for( var i = 0 ; i < groups.length; i++ ){
	    				if( groups[i] != "" ){
	    					var node = $(this).tree("find",groups[i]);
	    					$(this).tree("check",node.target );
	    				}
	    			}
	    		}
	    	}
	    }
	});
	

});
</script>

<style>
</style>
<div style="padding:5px">
	<form action="${path}/sysmanage/user/user_assignRole" name="assign_grouprole_form" >
		<input name="username" value="${data.username}" type="hidden" />
		<input name="roleIds" value="" type="hidden"/>
		<ul id="assign_grouprole_tree" ></ul>
		<!-- 
		<div style="margin:5px 0 0 0">
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="User.savePermission( this );">保存分配</a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="User.closePermission( this );">关闭</a>
		</div> -->
	</form>
</div> 
